import java.util.Scanner;
//输入一个串字符返回第一个只出现一次的字符下标
public class J2411042 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        firstUniquChar(str);

    }
    public static int firstUniquChar(String str){
        int[] count = new int[26];
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            count[ch - 'a']++;
        }
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if(count[ch - 'a'] == 1){
                System.out.println(i);
                return i;
            }
        }
        System.out.println(-1);
        return -1;
    }
}
